<?php
/**
 * 课程列表
 */

class Course_list_model extends CT_Model{
    public $_table = 'course_list';
    
    public function __construct()
    {
        parent::__construct();
        $this->load->database();
    }
    /**
     * 获取课程列表。链接课程分类表
     */
    public function course_list($conditions = NULL, $fields = '*', $order = NULL, $start = 0, $limit = NULL){
        try {
            if ($fields != NULL) {
                $this->db->select ( $fields );
            }
            $this->db->from($this->_table);
//             $this->db->join('course_package',"course_package.id = {$this->_table}.course_package_id", 'join');
//             $this->db->join('course_list','course_list.id = course_package.course_list_id', 'join');
            $this->db->join('course_cate','course_cate.id = course_list.course_cate_id', 'join');
            $this->db->join('nursery','nursery.id = course_cate.nursery_id', 'join');
            // 	        $this->db->join('member',"member.id = {$this->_table}.member_id", 'join');
             
            if ($conditions != NULL && $conditions) {
                if (is_array ( $conditions )) {
                    $this->db->where ( $conditions );
                } else {
                    $this->db->where ( $conditions, NULL, FALSE );
                }
            }
    
             
            if ($order != NULL) {
                $this->db->order_by ( $order );
            }
             
            if ($limit != NULL) {
                $this->db->limit ( $limit, $start );
            }
             
            return $this->db->get()->result_array();
             
             
        }catch (Exception $e){
             
        }
    }
}
